package com.ssy.lingxi.transaction.api.enums;

import com.ssy.lingxi.common.language.LanguageHolder;

import java.util.Arrays;

/**
* 商品询价-报价单内部枚举
* @author wrc
* @date 2020/11/18
*/
public enum QuoteInteriorStatusEnum {

    TO_BE_SUBMITTED_FOR_REVIEW(1,"待提交审核"),
    TO_BE_REVIEWED(2,"待审核(一级)"),
    TO_BE_REVIEWED_two(3,"待审核(二级)"),
    APPROVED(4,"待提交报价单)"),
    APPROVED_TWO(5,"已完成"),
    FAILED_TO_PASS_THE_AUDIT(6,"审核不通过(一级)"),
    FAILED_TO_PASS_THE_AUDIT2(7,"审核不通过(二级)");

    /**
     *状态
     */
    private Integer state;

    /**
     *描述
     */
    private String name;

    public static String getName(Integer state){
        QuoteInteriorStatusEnum workEnum = Arrays.stream(QuoteInteriorStatusEnum.values()).filter(v -> v.getState().equals(state)).findAny().orElse(null);
        return null == workEnum ? "" : LanguageHolder.getName(QuoteInteriorStatusEnum.class, workEnum.getState());
    }

    QuoteInteriorStatusEnum(Integer state, String name) {
        this.state = state;
        this.name = name;
    }

    public Integer getState() {
        return state;
    }

    public void setState(Integer state) {
        this.state = state;
    }

    public String getName() {
        return LanguageHolder.getName(this.getClass(), this.state);
    }

    public void setName(String name) {
        this.name = name;
    }
}
